# 设置项目根目录
$projectRoot = "F:\shopping"

# 启动auth-service
Write-Host "启动auth-service..." -ForegroundColor Green
Start-Process cmd.exe -ArgumentList "/k", "chcp 65001 >nul && cd /d $projectRoot\auth-service && java -jar target\auth-service-1.0.0.jar" -WindowStyle Normal

# 等待5秒
Start-Sleep -Seconds 5

# 启动user-service
Write-Host "启动user-service..." -ForegroundColor Green
Start-Process cmd.exe -ArgumentList "/k", "chcp 65001 >nul && cd /d $projectRoot\user-service && java -jar target\user-service-1.0.0.jar" -WindowStyle Normal

# 等待5秒
Start-Sleep -Seconds 5

# 启动product-service
Write-Host "启动product-service..." -ForegroundColor Green
Start-Process cmd.exe -ArgumentList "/k", "chcp 65001 >nul && cd /d $projectRoot\product-service && java -jar target\product-service-1.0.0.jar" -WindowStyle Normal

# 等待5秒
Start-Sleep -Seconds 5

# 启动order-service
Write-Host "启动order-service..." -ForegroundColor Green
Start-Process cmd.exe -ArgumentList "/k", "chcp 65001 >nul && cd /d $projectRoot\order-service && java -jar target\order-service-1.0.0.jar" -WindowStyle Normal

# 等待5秒
Start-Sleep -Seconds 5

# 启动gateway-service
Write-Host "启动gateway-service..." -ForegroundColor Green
Start-Process cmd.exe -ArgumentList "/k", "chcp 65001 >nul && cd /d $projectRoot\gateway-service && java -jar target\gateway-service-1.0.0.jar" -WindowStyle Normal

Write-Host "所有服务已启动！" -ForegroundColor Green
Write-Host ""
Write-Host "服务端口信息：" -ForegroundColor Yellow
Write-Host "auth-service: 8084" -ForegroundColor White
Write-Host "user-service: 8081" -ForegroundColor White
Write-Host "product-service: 8082" -ForegroundColor White
Write-Host "order-service: 8083" -ForegroundColor White
Write-Host "gateway-service: 8080" -ForegroundColor White
Write-Host ""
Write-Host "按任意键退出..." -ForegroundColor Yellow
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")